<script>
class Rect {
  #w = 0
  #h = 0
  // getter
  get w() {return this.#w}
  // setter
  set w(v) {this.#w = v}
  get h() {return this.#h}
  set h(v) {this.#h = v}
  get area() { return this.w * this.h}

  fn() {}
}
const r = new Rect()
// r.setW(100)
// r.setH(200)
r.w = 10 // r.w是左值
r.h = 20
let w = r.w // r.w是右值
console.log(r.area)// r.w r.h做右值使用

class Weather {
  #c // 摄氏度
  constructor(c){
    this.c = c
  }
  get c() { return this.#c}
  set c(v) { this.#c = v}
  get f() { // 华氏度
    return this.c / 5 * 9 + 32
  }
  set f(v) {
    this.c = (v-32)/9*5
  }
}
const x = new Weather(100)

</script>